/*
 *  Copyright 2011 yura.
 * 
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 * 
 *       http://www.apache.org/licenses/LICENSE-2.0
 * 
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 */
package org.opu.db_vdumper.beans;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author yura
 */
public class TableBean extends AbstractBean {

    private static final long serialVersionUID = 94110533334811061L;
	
    private String schema;
    private List<ColumnBean> columns;

    public TableBean(String name, String schema) {
        this(name, schema, new ArrayList<ColumnBean>());
    }

    public TableBean(String name, String schema, List<ColumnBean> columns) {
        super(name);
        this.schema = schema;
        this.columns = columns;
    }

    public List<ColumnBean> getColumns() {
        return columns;
    }

    public void setColumns(List<ColumnBean> columns) {
        this.columns.clear();
        this.columns.addAll(columns);
    }

    public String getSchema() {
        return schema;
    }

    public void setSchema(String schema) {
        this.schema = schema;
    }

    public boolean add(ColumnBean e) {
        return columns.add(e);
    }

    public ColumnBean get(int index) {
        return columns.get(index);
    }

    public int size() {
        return columns.size();
    }

    @Override
    public String toString() {
        return schema + "." + name + columns;
    }


}
